<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateShopsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shops', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('user.id');
            $table->string('promoter')->comment('发起人');
            $table->string('label')->comment('发起人标签，多个标签id用逗号隔开');
            $table->string('shop_type')->comment('店铺类型1线上2线下');
            $table->integer('browse_num')->default(0)->comment('浏览量');
            $table->string('phone')->comment('手机号');
            $table->string('longitude')->default(0)->comment("经度");
            $table->string('latitude')->default(0)->comment("纬度");
            $table->string('shop_name')->comment("店铺名称");
            $table->string('address')->comment("店铺地址");
            $table->string('wechat')->default('')->comment("微信号");
            $table->integer('area')->default(0)->comment("店铺面积");
            $table->string('shop_info',2000)->comment("店铺图片/json格式");
            $table->tinyInteger('step1')->default(0)->comment("方案一500");
            $table->tinyInteger('step2')->default(0)->comment("方案二1300");
            $table->tinyInteger('step3')->default(0)->comment("方案三5000");
            $table->decimal('shop_price', '16', '2')->default(0)->comment("拟众筹总金额");
            $table->integer('crowd_funding_start')->comment('众筹发起时间');
            $table->integer('crowd_funding_end')->comment('众筹结束时间');
            $table->integer('status')->comment('店铺状态0申请中1申请通过众筹中2申请未通过3众筹成功4众筹失败');
            $table->string('comment')->default('')->comment('备注');
            $table->decimal('crowd_fund', '16', '2')->default(0)->comment('已众筹金额');
            $table->decimal('shop_profit', '10', '2')->default(0)->comment("店铺收益");
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `shops` comment '店铺表';");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shops');
    }
}
